<template>
  <div class="teaEmployContainer">
    <BasicTablePagination :data="data" :column="column" :pagination="pagination" @sizeChange="sizeChange" @numChange="numChange"></BasicTablePagination>
  </div>
</template>

<script>
import BasicTablePagination from '@/components/BasicTablePagination/BasicTablePagination'
import { getEmployList } from '@/api/user'
import { tableColumn } from "@/constants/teaEmploy"

export default {
  name: "index",
  components: {
    BasicTablePagination
  },
  data() {
    return {
      data: [],
      column: tableColumn,
      pagination: {
        pageSize: 10,
        pageNum: 1,
        total: 0
      }
    }
  },
  methods: {
    async getData() {
      const res = await getEmployList(this.pagination)
      if (res.success == true) {
        this.data = res.data
        this.pagination.total = res.total
      } else {
        this.$message.error(res.errorMsg)
      }
    },
    sizeChange(val) {
      this.pagination.pageSize = val
      this.getData()
    },
    numChange(val) {
      this.pagination.pageNum = val
      this.getData()
    }
  },
  created() {
    this.getData()
  }
}
</script>

<style scoped lang="sass">
.teaEmployContainer
  padding: 20px
</style>
